﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<PagedList<Query>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Completed
</asp:Content>

<asp:Content ID="ContentHeader" ContentPlaceHolderID="ContentHeader" runat="server">
Completed Enquiries
</asp:Content>

<asp:Content ID="ContentSubNav" ContentPlaceHolderID="ContentSubNav" runat="server">
    <li class=""><%= Html.ActionLink("Create Enquiry", "Create", "Enquiry")%></li>
    <li class=""><%= Html.ActionLink("Open Enquiries", "Index", "Enquiry")%></li>
    <li class="selected"><%= Html.ActionLink("Completed Enquiries", "Completed", "Enquiry")%></li>
    <%--<li class=""><%= Html.ActionLink("Pending Compensation", "Pending", "Enquiry")%></li>--%>
    <li class=""><%= Html.ActionLink("Approved Compensation", "Approved", "Enquiry")%></li>
    <li class=""><%= Html.ActionLink("Declined Compensation", "Declined", "Enquiry")%></li>
<li class=""><%= Html.ActionLink("Complaints Alert", "ComplaintsAlert", "Enquiry")%></li>
    </asp:Content>
    

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<p>Completed enquiries.</p>
<div class="clearfix" style="border-bottom:2px solid red;margin:0 0 15px;padding:0 0 15px;">
    <a id="filterBtn">Filter</a>
    <input type="submit" class="clearBtn" value="Clear Filter" onClick="location.href='<%= Url.Action((string)null) %>';return false;">
    <div id="filterContainer">
        <div class="faux_form">
            <% Html.RenderPartial("FilterForm", "filter"); %>   
        </div>
    </div>
</div>
<%--<%= Html.ActionLink("Download", "DownloadCompletedEnqiries", this.ViewContext.GetAllExistingRouteValues(), new { title = "Download", @class = "btnDownload" })%>--%>
    <%= Html.ActionLink("Download", "DownloadCompletedEnqiries", this.ViewContext.GetAllExistingRouteValues(), new Dictionary<string, object> { { "Title", "Download" }, { "Class", "btnDownload" } })%>

<div id="table" style="display:block;">
    <table>
        <thead>
            <tr>
                <th><%= Html.ColumnHeader("Date Closed", new SortExpression<Query>().SortDesc(x => x.Updated)) %></th>
                <th><%= Html.ColumnHeader("Name", new SortExpression<Query>().SortAsc(x => x.LastName).SortAsc(x => x.FirstName)) %></th>
                <th><%= Html.ColumnHeader("Type", new SortExpression<Query>().SortDesc(x => x.QueryTypeId))%></th>
                <th><%= Html.ColumnHeader("Product Category", new SortExpression<Query>().SortDesc(x => x.CategoryId))%></th>
                <th>Product Name</th>
                <th><%= Html.ColumnHeader("Priority", new SortExpression<Query>().SortDesc(x => x.Priority))%> </th>
                <th></th>
            </tr>
        </thead>
        <tbody>
            <% foreach (var query in Model)
                {
                    %>
                    <tr>
                        <td><%= Html.Encode(query.Updated.ToShortDateString()) %></td>
                        <td><%= Html.Encode(query.LastName + (query.FirstName != null ? ", " + query.FirstName : "")) %></td>
                        <td><%= Html.Encode(query.QueryType.ToDisplayString()) %></td>
                        <td><%= Html.Encode(query.Category != null ? query.Category.Name : "") %></td>
                        <td><%= Html.Encode(query.Product != null ? query.Product.Name : "") %></td>
                        <td><%= Html.Encode(query.Priority) %></td>
                        <td >
                        <%= Html.ActionLink("Edit Item", "Edit", new { id = query.QueryId }, new { title = "Edit Item", @class = "btn btnEdit" })%>
                        <%= Html.ActionLink("View Item", "Details", new { id = query.QueryId }, new { title = "View Item", @class = "btn btnView" })%>
                        </td>
                    </tr>
                    <%
                }
            %>
        </tbody>
    </table>
    <%= Html.PagingDiv(Model) %>
</div>
     
</asp:Content>
